import {APP} from '@/services/api'
import {request, METHOD} from '@/utils/request'

/**
 *
 * @param pageQuery
 * @returns Promise<AxiosResponse>
 */
export async function page(pageQuery) {
    return request(APP.APP_PAGE, METHOD.POST, {
        ...pageQuery
    })
}

/**
 *
 * @param id
 * @returns Promise<AxiosResponse>
 */
export async function del(id) {
    return request(APP.APP_DELETE + `/${id}`, METHOD.POST, {})
}

/**
 *
 * @param config
 * @returns Promise<AxiosResponse>
 */
export async function save(config) {
    return request(APP.APP_ADD_OR_UPDATE, METHOD.POST, {
        ...config,
    })
}

export const columns = [
    {
        title: 'App名称',
        dataIndex: 'name',
        align: 'center',
    },
    {
        title: 'App图标',
        dataIndex: 'icon',
        align: 'center',
    },
    {
        title: 'App路径',
        dataIndex: 'path',
        align: 'center',
    },
    {
        title: '操作',
        align: 'center',
        scopedSlots: {customRender: 'action'}
    }
]
